﻿/**********************************************************************
 * @file   GUIGeometryStretchDialog.h
 * @brief  拉伸界面
 * @author yangjing (1195810980@qq.com)
 * @date   2025-02-27
 *********************************************************************/
#ifndef __GUIGeometryLineFromStretchDialog_H__
#define __GUIGeometryLineFromStretchDialog_H__
#include <array>

#include "GUIGeometryBaseDialog.h"

namespace Ui { class GUIGeometryStretchDialog; }
namespace Interface
{
    class FITKAbsGeoModelSegment;
}
namespace GUI {
    /**
    * @brief 创建拉伸窗口
    * @author yangjing (1195810980@qq.com)
    * @date 2025-02-20
    */
    class GUIGeometryDialogAPI GUIGeometryStretchDialog : public GUIGeometryBaseDialog
    {
        Q_OBJECT

    public:
        /**
        * @brief 创建的构造函数
        * @param[i]  oper           operators
        * @author yangjing (1195810980@qq.com)
        * @date 2025-02-11
        */
        GUIGeometryStretchDialog(Core::FITKActionOperator* oper, QWidget* parent = nullptr);
        /**
         * @brief 编辑的构造函数
         * @param[i]  obj            My Param doc
         * @param[i]  oper           My Param doc
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-11
         */
        GUIGeometryStretchDialog(Interface::FITKAbsGeoModelSegment* obj, Core::FITKActionOperator* oper, QWidget* parent = nullptr);
        /**
         * @brief 析构函数
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-11
         */
        ~GUIGeometryStretchDialog();
        /**
         * @brief init
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-11
         */
        void init() override;

    private:
        /**
        * @brief    获取设置的名称
        * @return   QString
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-11
        */
        QString getNameText() override;

        /**
        * @brief    拾取完成操作器,点击后，触发
        * @return   void
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-11
        */
        virtual void pickFinishedOper() override;


        /**
         * @brief 从界面获取数据，更新到数据对象中
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-11
         */
        virtual void getDataFormWidget()override;



        /**
        * @brief    拾取过程中触发,用于计算拾取到个数
        * @return   void
         * @author yangjing (1195810980@qq.com)
         * @date 2025-02-19
        */
        virtual void OnpickInProcess() override;
    private slots:


        /**
        * @brief 选择拉伸目标响应
        * @author yangjing (1195810980@qq.com)
        * @date 2025-03-03
        */
        void on_stretch_type_activated(int);


        /**
        * @brief 点选取按钮响应
        * @author yangjing (1195810980@qq.com)
        * @date 2025-02-11
        */
        void on_pushButton_Pick_clicked();

        /**
        * @brief确认按钮响应
        * @author yangjing (1195810980@qq.com)
        * @date 2025-02-11
        */
        void on_pushButton_OK_clicked();

        /**
        * @brief    取消按钮响应
        * @return   void
        * @author yangjing (1195810980@qq.com)
        * @date 2025-02-19
        */
        void on_pushButton_Cancel_clicked();

        /**
        * @brief    输入框响应，用于更新拉伸方向
        * @return   void
        * @author yangjing (1195810980@qq.com)
        * @date 2025-02-19
        */
        void on_lineEdit_X_editingFinished();
        void on_lineEdit_Y_editingFinished();
        void on_lineEdit_Z_editingFinished();

    private:
        /**
        * @brief传入ID，获取该点的xyz数据
        * @author yangjing (1195810980@qq.com)
        * @date 2025-02-11
        */
        std::array<double, 3>getPointXYZ(int id);

        /**
        * @brief检查选择的点数据是否正确，方向数据和长度是否正确
        * @author yangjing (1195810980@qq.com)
        * @date 2025-02-11
        */
        QString checkArgc();

        /**
        * @brief创建和更新拉伸方向
        * @author yangjing (1195810980@qq.com)
        * @date 2025-02-28
        */
        void direction_updata();
        /**
        * @brief创建和更新拉伸方向
        * @author yangjing (1195810980@qq.com)
        * @date 2025-03-03
        */
        void typeFromGeometryObj();

    private:
        Ui::GUIGeometryStretchDialog *_ui = nullptr;
    };
}
#endif // GUIGeometryLineFromStretchDialog_H

